﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PapaetisNew
{
    public partial class frmSupplierItemSearch : Form
    {
        public frmSupplierItemSearch()
        {
            InitializeComponent();
        }

        private void tAL_SUPPLIER_ITEMSBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.tAL_SUPPLIER_ITEMSBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.dsSupplierItems);

        }

        private void frmSupplierItemSearch_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dsSupplierItems.TAL_SUPPLIER_ITEMS' table. You can move, or remove it, as needed.
            this.tAL_SUPPLIER_ITEMSTableAdapter.Fill(this.dsSupplierItems.TAL_SUPPLIER_ITEMS);

        }

        private void txtSearchString_TextChanged(object sender, EventArgs e)
        {
            DataView dv = new DataView();
             dv.Table = this.dsSupplierItems.Tables[0]; /// dsSupplierItems.Tables[0]; 
                                                        /// 
             dv.RowFilter = "SUPPLIERNAMEITEM Like " + "'%" + txtSearchString.Text + "%'"; // +txtSearchString.Text;
               //"SUPPLIERNAMEITEM Like" + '('+ "" + txtSearchString.Text + "%"+')'
               tAL_SUPPLIER_ITEMSDataGridView.DataSource= dv;
              /// dv.RowFilter = "Nume like " + "'%" + Cod.Text + "%'";


        }
        private void MakeDataView()
        {
            DataView view = new DataView();

            view.Table = this.dsSupplierItems.Tables[0]; /// .Tables["Suppliers"];
            view.AllowDelete = true;
            view.AllowEdit = true;
            view.AllowNew = true;
            view.RowFilter = "SUPPLIERNAMEITEM =  'HEIMAN'";
            view.RowStateFilter = DataViewRowState.ModifiedCurrent;
            view.Sort = "SUPPLIERNAMEITEM DESC";

            // Simple-bind to a TextBox control
            //this.txtSearchString.DataBindings.Add("Text", view, "SUPPLIERNAMEITEM");
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            MakeDataView();
        }

        private void tAL_SUPPLIER_ITEMSBindingNavigator_RefreshItems(object sender, EventArgs e)
        {

        }


    }
}
